package com.anycc.cloud.core.service;

import com.anycc.cloud.common.dto.query.PagingRequest;
import com.anycc.cloud.common.dto.query.PagingResponse;
import com.anycc.cloud.core.entity.Role;

import java.util.List;

/**
 * role  service
 */
public interface RoleService {

    /**
     * create a new role
     *
     * @param role role
     * @return Role
     */
    Role create(Role role);

    /**
     * delete permission by module id
     *
     * @param moduleId module id
     */
    void deletePermissionsByModuleId(String moduleId);

    /**
     * delete role"s permission by permission id
     *
     * @param deletePermissionIds deletePermissionIds
     */
    void deletePermissions(List<String> deletePermissionIds);

    /**
     * paging query
     *
     * @param role          role
     * @param pagingRequest paging param
     * @return PagingResponse
     */
    PagingResponse<Role> findByPaging(Role role, PagingRequest pagingRequest);

    /**
     * delete role by id
     *
     * @param id id
     */
    void delete(String id);

    /**
     * find role by id
     *
     * @param id role id
     * @return role
     */
    Role findById(String id);

    /**
     * update role
     *
     * @param role role
     * @return Module
     */
    Role update(Role role);

    /**
     * find all role(asc)
     *
     * @return list
     */
    List<Role> findAllByNameAsc();
}
